import time

from selenium.webdriver.common.by import By

from utils.webdriver_factory import WebDriverFactory

driver = WebDriverFactory.get_instance()

# 通过text属性获取元素包含的文本
driver.get("http://www.baidu.com")
title = driver.find_element(By.CLASS_NAME, 'title-content-title')
text = title.text
time.sleep(3)
print(text)

# 通过get_attribute获取对应的属性值
search_button = driver.find_element(By.ID, 'su')
value = search_button.get_attribute('value')
print(value)
